import request from '@/utils/request'

// 查询维修记录列表
export function listRepair(query) {
  return request({
    url: '/system/repair/list',
    method: 'get',
    params: query
  })
}

// 查询维修记录详细
export function getRepair(id) {
  return request({
    url: '/system/repair/' + id,
    method: 'get'
  })
}

// 新增维修记录
export function addRepair(data) {
  return request({
    url: '/system/repair',
    method: 'post',
    data: data
  })
}

// 修改维修记录
export function updateRepair(data) {
  return request({
    url: '/system/repair',
    method: 'put',
    data: data
  })
}

// 删除维修记录
export function delRepair(id) {
  return request({
    url: '/system/repair/' + id,
    method: 'delete'
  })
}

// 获取资产维修历史
export function getRepairHistory(query) {
  return request({
    url: '/system/record/list',
    method: 'get',
    params: query
  })
}

// 根据维修单号获取完整维修履历
export function getCompleteRepairHistoryByWorkNo(workNo) {
  return request({
    url: '/system/record/work/' + workNo,
    method: 'get'
  })
}

// 获取维修统计信息
export function getRepairStatistics() {
  return request({
    url: '/system/repair/statistics',
    method: 'get'
  })
}

// 导出维修记录
export function exportRepair(query) {
  return request({
    url: '/system/repair/export',
    method: 'get',
    params: query
  })
}
